]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceAnimation: Perform a grab during workspace switch gestures
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Dec 2025 12:24:41 +0000 (13:24 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 19 Jan 2026 16:28:44 +0000 (16:28 +0000)
Currently, the mechanism to reclaim touch input from clients and into
the gesture is somewhat indirect:
- The swipeTracker gesture(s) will enter in a recognized state
- The MetaGestureTracker will notice the recognized state on a gesture
  set up in the ClutterStage actor, and emit META_SEQUENCE_ACCEPTED
  on the sequence
- The core will notice the sequence being accepted and call
  meta_display_cancel_touch()/meta_wayland_touch_cancel()
- This eventually results in wl_touch.cancel on the affected client(s)

This is a bit too convoluted and special cased, so claim input using
a more traditional way: Using a Clutter grab. This will also result in
touch being cancelled on the Wayland side. This will happen along with
other input, but that's actually a consistence improvemente, since the
other method would not prevent other input (e.g. pointer) while the
workspace gesture is ongoing. This results in glitchy behavior if
multiple input devices are used simultaneously.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4020>

js/ui/workspaceAnimation.js

index 8d7b2594ee61edfdb27b3b12490580b53a18ebde..5bb2a10a76bbe2a3c42ac1d9bd8c5acd10522689 100644 (file)
@@ -405,11 +405,19 @@ export class WorkspaceAnimationController {
         }
 
         global.compositor.disable_unredirect();
+        this._grab = Main.pushModal(global.stage, {
+            actionMode: Shell.ActionMode.NORMAL,
+        });
     }
 
     _finishWorkspaceSwitch(switchData) {
         global.compositor.enable_unredirect();
 
+        if (this._grab) {
+            Main.popModal(this._grab);
+            this._grab = null;
+        }
+
         this._switchData = null;
 
         switchData.monitors.forEach(m => m.destroy());